<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <p>根据浏览器hash值，修改指定容器内容。</p>
    <a href="#/a">A页面</a>
    <a href="#/b">B页面</a>
    <div id="app"></div>

    <script>
      function render() {
        app.innerHTML = window.location.hash;
      }
      window.addEventListener("hashchange", render);
      render();
    </script>
  </body>
</html>
